﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Main.Master" AutoEventWireup="true" CodeBehind="InventoryManagementUpdate.aspx.cs" Inherits="RestaurantManagerWebApp.Pages.StockManagement.InventoryManagementUpdate" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Table ID="tblControl" runat="server">
        <asp:TableRow>
            <asp:TableCell HorizontalAlign="Center"><strong>Add</strong><br /><a href="InventoryManagementAdd.aspx"><img alt="add_icon" width="100px" src="../../Images/Controls/Button-Add-icon.png" /></a>
            </asp:TableCell>
            <asp:TableCell HorizontalAlign="Center"><strong>View</strong><br /><a href="InventoryManagementView.aspx"><img alt="view_icon" width="100px" src="../../Images/Controls/Dj-View-icon.png" /></a>
            </asp:TableCell>
            <asp:TableCell HorizontalAlign="Center"><strong>Update</strong><br /><a href="InventoryManagementUpdate.aspx"><img alt="update_icon" width="100px" src="../../Images/Controls/edit-validated-icon.png" /></a>
            </asp:TableCell>
            <asp:TableCell HorizontalAlign="Center"><strong>Delete</strong><br /><a href="InventoryManagementDelete.aspx"><img alt="delete_icon" width="100px" src="../../Images/Controls/Alarm-Error-icon.png" /></a>
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
     <h2>Inventory[UPDATE]</h2>
     <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="i_name" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
         <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
         <Columns>
             <asp:BoundField DataField="i_name" HeaderText="i_name" ReadOnly="True" SortExpression="i_name" />
             <asp:BoundField DataField="i_quantity" HeaderText="i_quantity" SortExpression="i_quantity" />
             <asp:BoundField DataField="m_name" HeaderText="m_name" SortExpression="m_name" />
             <asp:CommandField ButtonType="Button" ShowEditButton="True" />
         </Columns>
         <EditRowStyle BackColor="#999999" />
         <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
         <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
         <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
         <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
         <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
         <SortedAscendingCellStyle BackColor="#E9E7E2" />
         <SortedAscendingHeaderStyle BackColor="#506C8C" />
         <SortedDescendingCellStyle BackColor="#FFFDF8" />
         <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
     </asp:GridView>
    <br />
     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RestaurantConnectionString %>" DeleteCommand="DELETE FROM [Ingredient] WHERE [i_name] = @i_name" InsertCommand="INSERT INTO [Ingredient] ([i_name], [i_quantity], [m_id]) VALUES (@i_name, @i_quantity, @m_id)" SelectCommand="SELECT Ingredient.i_name, Ingredient.i_quantity, Metrics.m_name FROM Ingredient INNER JOIN Metrics ON Ingredient.m_id = Metrics.m_id" UpdateCommand="UPDATE [Ingredient] SET [i_quantity] = @i_quantity, [m_id] = @m_id WHERE [i_name] = @i_name">
         <DeleteParameters>
             <asp:Parameter Name="i_name" Type="String" />
         </DeleteParameters>
         <InsertParameters>
             <asp:Parameter Name="i_name" Type="String" />
             <asp:Parameter Name="i_quantity" Type="Decimal" />
             <asp:Parameter Name="m_id" Type="Int32" />
         </InsertParameters>
         <UpdateParameters>
             <asp:Parameter Name="i_quantity" Type="Decimal" />
             <asp:Parameter Name="m_id" Type="Int32" />
             <asp:Parameter Name="i_name" Type="String" />
         </UpdateParameters>
     </asp:SqlDataSource>
    <br />
    
</asp:Content>
